import { getTeacherDetail } from '../../../api/user'

Page({

  /**
   * 页面的初始数据
   */
  data: {
    user: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.init(options.userId)
  },
  init(id) {
    getTeacherDetail({ userId: id }).then(res => {
      this.setData({
        user: res
      })
    })
  },
  back() {
    wx.navigateBack({
      delta: 1
    })
  },
  toPageMessage: function() {
    wx.navigateTo({ url: '/packageA/pages/message/message?userId' + this.data.user.userId })
  }
})
